package com.qls.web.modules.ord.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qls.core.entity.OrdOrder;
import com.qls.web.common.utils.PageUtils;
import com.qls.web.common.utils.Query;
import com.qls.web.modules.ord.dao.OrdOrderDao;
import com.qls.web.modules.ord.entity.OrdOrderVO;
import com.qls.web.modules.ord.service.OrdOrderService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author doyoung
 */
@Service
public class OrdOrderServiceImpl extends ServiceImpl<OrdOrderDao, OrdOrder> implements OrdOrderService {

    @Override
    public PageUtils sqlQuryPage(Map<String, Object> params) {
        String dtId = params.get("dtId").toString();
        String startTime = null;
        String endTime = null;
        List dateTime;
        dateTime = (List) params.get("dateTime");
        if (dateTime != null) {
            startTime = dateTime.get(0).toString();
            endTime = dateTime.get(1).toString();
        }
        String ordCode = params.get("ordCode").toString();
        String phone = params.get("phone").toString();
        IPage<OrdOrderVO> page = new Query<OrdOrderVO>().getPage(params);
        List<OrdOrderVO> list = baseMapper.sqlQuryPage(page, dtId, startTime, endTime, ordCode, phone);
        PageUtils pageUtils = new PageUtils(page, list);
        return pageUtils;
    }
}
